package AlgoWangZheng;

/**
 * @author kakayubei
 * @description
 * @date 2021/10/24 10:21
 */
public class ArrayStack {
    private String[] stack;
    private int count; //栈元素个数
    private int n; //栈大小

    public ArrayStack(int n) {
        this.n = n;
        this.stack = new String[n];
        this.count = 0;
    }

    //入栈
    public boolean push(String item) {
        if (count == n) {
            return false;
        }
        stack[count++] = item;
        return true;
    }

    //出栈
    public String pop() {
        if (count == 0) {
            return null;
        }
        return stack[--count];
    }
}
